﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcDDshop2.Controllers
{
    public class ListController : Controller
    {
        //
        // GET: /List/

        public ActionResult List()
        {
            if (Request["sou"] != null)
            {
                string key = Request["sou"];
                List<Book> books = BLL.Bll.select_key(key);
                ViewBag.books = books;
                Book book1 = BLL.Bll.book_id(72);
                Book book2 = BLL.Bll.book_id(68);
                ViewBag.book1 = book1;
                ViewBag.book2 = book2;
                return View();
            }
            if(Request["type"] != null) 
            {
                int id = Convert.ToInt32(Request["type"]);
                List<Book> books = BLL.Bll.books_typeid(id);
                ViewBag.books = books;
                Book book1 = BLL.Bll.book_id(72);
                Book book2 = BLL.Bll.book_id(68);
                ViewBag.book1 = book1;
                ViewBag.book2 = book2;
                return View();
            }
            return View();
        }

    }
}
